<div>
    <form #formRef="ngForm" (ngSubmit)="onSubmit(formRef.value)">
        <fieldset ngModelGroup="login">
            <input type="text" name="username" [(ngModel)]="username" #usernameRef="ngModel" required minlength="3" />
            <div *ngIf="usernameRef.errors?.required">this is required</div>
            <div *ngIf="usernameRef.errors?.minlength">should be at least 3 charactors</div>
            <input type="password" name="password" [(ngModel)]="password" #passwordRef="ngModel" required />
            <div *ngIf="passwordRef.errors?.required">this is required</div>
            <button types="submit">Login</button>
            <div *ngIf="auth?.hasError">{{auth.errMsg}}</div>
        </fieldset>
    </form>
</div>
